import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/user/login',
      component: () => import('@/views/LoginPage.vue')
    },
    {
      path: '/',
      component: () => import('@/views/LayoutPage.vue'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          component: () => import('@/views/HomePage.vue')
        },
        {
          path: '/personal',
          component: () => import('@/views/PersonalPage.vue')
        },
        {
          path: '/user',
          component: () => import('@/views/UserPage.vue')
        },
        {
          path: '/classify',
          component: () => import('@/views/ClassifyPage.vue')
        },
        {
          path: '/personalblog',
          component: () => import('@/views/PersonalBlog.vue')
        },
        {
          path: '/userblog',
          component: () => import('@/views/UserBlog.vue')
        }
      ]

      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
    }
  ]
})

export default router
